package com.hnkywl.sts.quartz;

import com.hnkywl.sts.entity.xsgl.Dfkxsd;
import com.hnkywl.sts.service.base.WebserviceTransService;
import com.hnkywl.sts.service.taskdeal.DoQueryContract;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.util.CollectionUtils;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 14-1-2
 * Time: 上午11:05
 * To change this template use File | Settings | File Templates.
 */
public class QueryContractJob extends QuartzJobBean {

    private DoQueryContract doQueryContract;
    private WebserviceTransService webserviceTransService;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
//        Map<String,List<Dfkxsd>> dfkxsdMap = doQueryContract.findDfkxsdList();
//        Integer count = 10;
//        if (!CollectionUtils.isEmpty(dfkxsdMap)) {
//            for(String key : dfkxsdMap.keySet()){
//                try {
//                    String args = doQueryContract.generateArgsString(dfkxsdMap.get(key), count);
//                    String memberCode = key;
//                    //返回的Json串
//                    String contractResponse = webserviceTransService.queryContractWebServiceArgs(memberCode, args);
//                    //业务逻辑处理
//                    doQueryContract.dealByContractResponse(dfkxsdMap.get(key), contractResponse);
//                } catch (Exception e) {
//                    e.printStackTrace();
//                    doQueryContract.deleteOrderIdListWhenException(dfkxsdMap.get(key), e.getMessage());
//                }
//            }
//        }
    }

    public void setDoQueryContract(DoQueryContract doQueryContract) {
        this.doQueryContract = doQueryContract;
    }

    public void setWebserviceTransService(WebserviceTransService webserviceTransService) {
        this.webserviceTransService = webserviceTransService;
    }
}
